package tk.deep.listener;


import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

/**
 * Created by boot on 8/28/15.
 */
public class MyContextListener implements ServletContextListener {
    /**
     * 通下事情:
     * 1.定时器
     * 2.全局属性对象
     * 3.创建全局的数据库连接
     * 4.加载缓存信息信息
     *
     * @param sce
     */
    public void contextInitialized(ServletContextEvent sce) {
        String aa = sce.getServletContext().getInitParameter("aa"); // get the parameters from web.xml

        System.out.format("Get the init timer parameters:%s", aa);
        System.out.println("context is started.");
    }


    /**
     * @param sce
     */
    public void contextDestroyed(ServletContextEvent sce) {

        System.out.println("Context is destroyed.");
    }
}
